

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>nrgpy.utils package &mdash; nrgpy 0.10.19 documentation</title>
  

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <script src="_static/jquery.js"></script>
        <script src="_static/underscore.js"></script>
        <script src="_static/doctools.js"></script>
    
    <script type="text/javascript" src="_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="index.html" class="icon icon-home"> nrgpy
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <!-- Local TOC -->
              <div class="local-toc"><ul>
<li><a class="reference internal" href="#">nrgpy.utils package</a><ul>
<li><a class="reference internal" href="#submodules">Submodules</a></li>
<li><a class="reference internal" href="#module-nrgpy.utils.ipk2lgr">nrgpy.utils.ipk2lgr module</a></li>
<li><a class="reference internal" href="#nrgpy-utils-nsd-functions-module">nrgpy.utils.nsd_functions module</a></li>
<li><a class="reference internal" href="#module-nrgpy.utils.utilities">nrgpy.utils.utilities module</a></li>
<li><a class="reference internal" href="#module-nrgpy.utils">Module contents</a></li>
</ul>
</li>
</ul>
</div>
            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">nrgpy</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
        
      <li>nrgpy.utils package</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="_sources/nrgpy.utils.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="nrgpy-utils-package">
<h1>nrgpy.utils package<a class="headerlink" href="#nrgpy-utils-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-nrgpy.utils.ipk2lgr">
<span id="nrgpy-utils-ipk2lgr-module"></span><h2>nrgpy.utils.ipk2lgr module<a class="headerlink" href="#module-nrgpy.utils.ipk2lgr" title="Permalink to this headline">¶</a></h2>
<dl class="py function">
<dt id="nrgpy.utils.ipk2lgr.callinterval">
<code class="sig-prename descclassname">nrgpy.utils.ipk2lgr.</code><code class="sig-name descname">callinterval</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">original</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/nrgpy/utils/ipk2lgr.html#callinterval"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nrgpy.utils.ipk2lgr.callinterval" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py function">
<dt id="nrgpy.utils.ipk2lgr.calltime">
<code class="sig-prename descclassname">nrgpy.utils.ipk2lgr.</code><code class="sig-name descname">calltime</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">original</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/nrgpy/utils/ipk2lgr.html#calltime"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nrgpy.utils.ipk2lgr.calltime" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py function">
<dt id="nrgpy.utils.ipk2lgr.ipackinfo">
<code class="sig-prename descclassname">nrgpy.utils.ipk2lgr.</code><code class="sig-name descname">ipackinfo</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">typeint</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/nrgpy/utils/ipk2lgr.html#ipackinfo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nrgpy.utils.ipk2lgr.ipackinfo" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py function">
<dt id="nrgpy.utils.ipk2lgr.ipackinfo_backup">
<code class="sig-prename descclassname">nrgpy.utils.ipk2lgr.</code><code class="sig-name descname">ipackinfo_backup</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">phonestr</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/nrgpy/utils/ipk2lgr.html#ipackinfo_backup"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nrgpy.utils.ipk2lgr.ipackinfo_backup" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py function">
<dt id="nrgpy.utils.ipk2lgr.ipk2lgr">
<code class="sig-prename descclassname">nrgpy.utils.ipk2lgr.</code><code class="sig-name descname">ipk2lgr</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">ipkfile</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/nrgpy/utils/ipk2lgr.html#ipk2lgr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nrgpy.utils.ipk2lgr.ipk2lgr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</div>
<div class="section" id="nrgpy-utils-nsd-functions-module">
<h2>nrgpy.utils.nsd_functions module<a class="headerlink" href="#nrgpy-utils-nsd-functions-module" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-nrgpy.utils.utilities">
<span id="nrgpy-utils-utilities-module"></span><h2>nrgpy.utils.utilities module<a class="headerlink" href="#module-nrgpy.utils.utilities" title="Permalink to this headline">¶</a></h2>
<dl class="py function">
<dt id="nrgpy.utils.utilities.affirm_directory">
<code class="sig-prename descclassname">nrgpy.utils.utilities.</code><code class="sig-name descname">affirm_directory</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">directory</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/nrgpy/utils/utilities.html#affirm_directory"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nrgpy.utils.utilities.affirm_directory" title="Permalink to this definition">¶</a></dt>
<dd><p>create directory if not exists</p>
<p>print status to terminal</p>
</dd></dl>

<dl class="py function">
<dt id="nrgpy.utils.utilities.check_platform">
<code class="sig-prename descclassname">nrgpy.utils.utilities.</code><code class="sig-name descname">check_platform</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/nrgpy/utils/utilities.html#check_platform"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nrgpy.utils.utilities.check_platform" title="Permalink to this definition">¶</a></dt>
<dd><p>determine which operating system python is running on</p>
</dd></dl>

<dl class="py function">
<dt id="nrgpy.utils.utilities.count_files">
<code class="sig-prename descclassname">nrgpy.utils.utilities.</code><code class="sig-name descname">count_files</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">directory</span></em>, <em class="sig-param"><span class="n">filters</span></em>, <em class="sig-param"><span class="n">extension</span></em>, <em class="sig-param"><span class="n">show_files</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/nrgpy/utils/utilities.html#count_files"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nrgpy.utils.utilities.count_files" title="Permalink to this definition">¶</a></dt>
<dd><p>counts the number of files in the first level of a directory</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>directory</strong><span class="classifier">str</span></dt><dd><p>path of directory to be checked</p>
</dd>
<dt><strong>filters</strong><span class="classifier">str</span></dt><dd><p>filter present in file to be checked</p>
</dd>
<dt><strong>extension</strong><span class="classifier">str</span></dt><dd><p>secondary filter</p>
</dd>
<dt><strong>show_files</strong><span class="classifier">bool, optional</span></dt><dd><p>if set to True, prints file name</p>
</dd>
<dt><strong>start_time</strong><span class="classifier">int</span></dt><dd><p>seconds; if set, use as reference; only count if file is newer than start_time</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="nrgpy.utils.utilities.data_months">
<code class="sig-prename descclassname">nrgpy.utils.utilities.</code><code class="sig-name descname">data_months</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">start_date</span></em>, <em class="sig-param"><span class="n">end_date</span></em>, <em class="sig-param"><span class="n">output</span><span class="o">=</span><span class="default_value">'string'</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/nrgpy/utils/utilities.html#data_months"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nrgpy.utils.utilities.data_months" title="Permalink to this definition">¶</a></dt>
<dd><p>returns list of months for a date range in YYYY-mm-dd format</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>start_date</strong><span class="classifier">str or datetime</span></dt><dd><p>YYYY-mm-dd formatted date or datetime object</p>
</dd>
<dt><strong>end_date</strong><span class="classifier">str or datetime</span></dt><dd><p>must be same formatting as start_date or god help you</p>
</dd>
<dt><strong>output</strong><span class="classifier">str</span></dt><dd><p>“string” or “datetime”; specify date types you want returned.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt>list</dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="nrgpy.utils.utilities.date_check">
<code class="sig-prename descclassname">nrgpy.utils.utilities.</code><code class="sig-name descname">date_check</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">start_date</span></em>, <em class="sig-param"><span class="n">end_date</span></em>, <em class="sig-param"><span class="n">string</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/nrgpy/utils/utilities.html#date_check"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nrgpy.utils.utilities.date_check" title="Permalink to this definition">¶</a></dt>
<dd><p>returns true if string date is between dates</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>start_date</strong><span class="classifier">str</span></dt><dd><p>“YYYY-mm-dd”</p>
</dd>
<dt><strong>end_date</strong><span class="classifier">str</span></dt><dd><p>“YYYY-mm-dd”</p>
</dd>
<dt><strong>string</strong><span class="classifier">str</span></dt><dd><p>string including date to check</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="nrgpy.utils.utilities.draw_progress_bar">
<code class="sig-prename descclassname">nrgpy.utils.utilities.</code><code class="sig-name descname">draw_progress_bar</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">index</span></em>, <em class="sig-param"><span class="n">total</span></em>, <em class="sig-param"><span class="n">start_time</span></em>, <em class="sig-param"><span class="n">barLen</span><span class="o">=</span><span class="default_value">45</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/nrgpy/utils/utilities.html#draw_progress_bar"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nrgpy.utils.utilities.draw_progress_bar" title="Permalink to this definition">¶</a></dt>
<dd><p>simple text progress bar</p>
</dd></dl>

<dl class="py function">
<dt id="nrgpy.utils.utilities.linux_folder_path">
<code class="sig-prename descclassname">nrgpy.utils.utilities.</code><code class="sig-name descname">linux_folder_path</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">folder_path</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/nrgpy/utils/utilities.html#linux_folder_path"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nrgpy.utils.utilities.linux_folder_path" title="Permalink to this definition">¶</a></dt>
<dd><p>assert folder_path ending with ‘/’</p>
</dd></dl>

<dl class="py function">
<dt id="nrgpy.utils.utilities.load">
<code class="sig-prename descclassname">nrgpy.utils.utilities.</code><code class="sig-name descname">load</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">site_number</span><span class="o">=</span><span class="default_value">''</span></em>, <em class="sig-param"><span class="n">filename</span><span class="o">=</span><span class="default_value">''</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/nrgpy/utils/utilities.html#load"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nrgpy.utils.utilities.load" title="Permalink to this definition">¶</a></dt>
<dd><p>recall a reader from a pickle file by site number or filename</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>site_number</strong><span class="classifier">str</span></dt><dd><p>6-digit site number of stored reader OR spidar serial number</p>
</dd>
<dt><strong>filename</strong><span class="classifier">str</span></dt><dd><p>full or relative path of pickle file</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt>object</dt><dd><p>contents of pickle file</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt id="nrgpy.utils.utilities.renamer">
<em class="property">class </em><code class="sig-prename descclassname">nrgpy.utils.utilities.</code><code class="sig-name descname">renamer</code><a class="reference internal" href="_modules/nrgpy/utils/utilities.html#renamer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nrgpy.utils.utilities.renamer" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>for replacing duplicate column names after transpose</p>
<p class="rubric">Methods</p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">__call__</span></code>(x)</p></td>
<td><p>Call self as a function.</p></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="py function">
<dt id="nrgpy.utils.utilities.save">
<code class="sig-prename descclassname">nrgpy.utils.utilities.</code><code class="sig-name descname">save</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">reader</span></em>, <em class="sig-param"><span class="n">filename</span><span class="o">=</span><span class="default_value">''</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/nrgpy/utils/utilities.html#save"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nrgpy.utils.utilities.save" title="Permalink to this definition">¶</a></dt>
<dd><p>save reader as a Python pickle file, to be recalled later</p>
</dd></dl>

<dl class="py function">
<dt id="nrgpy.utils.utilities.windows_folder_path">
<code class="sig-prename descclassname">nrgpy.utils.utilities.</code><code class="sig-name descname">windows_folder_path</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">folder_path</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/nrgpy/utils/utilities.html#windows_folder_path"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nrgpy.utils.utilities.windows_folder_path" title="Permalink to this definition">¶</a></dt>
<dd><p>convert ‘/’ to ‘' in folder_path and assert ending in ‘'</p>
</dd></dl>

</div>
<div class="section" id="module-nrgpy.utils">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-nrgpy.utils" title="Permalink to this headline">¶</a></h2>
</div>
</div>


           </div>
           
          </div>
          <footer>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2020, NRG Systems, Technical Services.

    </p>
  </div>
    
    
    
    Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    
    provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>